#!/usr/bin/env python
import sys, os
from django.conf import settings
from django.conf.urls import url
from django.core.wsgi import get_wsgi_application
from django.http import HttpResponse
import views


BASE_DIR=os.path.dirname(os.path.abspath(__file__))

settings.configure(
    DEBUG=True,
    SECRET_KEY='THISISTHESUPERSECTRETKEY',
    BASE_DIR=BASE_DIR,
    ROOT_URLCONF=__name__,
    ALLOWED_HOSTS=[u'192.168.1.50', 'localhost', ],
    STATIC_URL='/static/',
    SITE_PAGES_DIRECTORY=os.path.join(BASE_DIR,'templates/pages'),
    INSTALLED_APPS = [
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.staticfiles',
    ],
    TEMPLATES=[{
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR, BASE_DIR+'/templates/', BASE_DIR+'/templates/pages/',],
    }],
)


def index(request):
    return HttpResponse('Hello')


urlpatterns = {
    url(r'^$', index),
    url(r'^(?P<slug>[\w\d./-]+)/$', views.page, name='page'),
    #url(r'page1/$', views.page, name='page1'),
}

application = get_wsgi_application()

if __name__ == '__main__':
    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)